from multiprocessing import Process,Queue
import os

# 复制文件
def copy(old,new,file,q):
    fr = open(old+'/'+file,'rb')
    fw = open(new+'/'+file,'wb')

    while True:
        data = fr.read()
        if not data:
            break
        fw.write(data)
    fr.close()
    fw.close()
    q.put(file)

def main(old):
    q = Queue()
    new = old.split('/')[-1]
    os.mkdir(new) # 创建新文件夹
    jobs = []
    for file in os.listdir(old):
        p = Process(target=copy,args=(old,new,file,q))
        jobs.append(p)
        p.start()
    [i.join() for i in jobs]
    print("拷贝了如下文件：")
    while q.qsize():
        print(q.get())

if __name__ == '__main__':
    main("D:/picture/ai_create_vedio")